home *** CD-ROM | disk | FTP | other *** search
- #include <iostream.h>
-
- class XXX { ... };
-
- int f()
- {
- int i;
- // ...
- if (... something wrong ...)
- throw 2;
- }
-
- int g()
- {
- XXX x;
- unsigned long ul;
- // ...
- if (... something else wrong ...)
- throw x;
- return f();
- }
-
- int h()
- {
- try
- {
- // ...
- g();
- // ...
- return 0;
- }
- catch (int n)
- {
- cerr << "# " << n << " happened\n";
- return n;
- }
- catch (char *s)
- {
- cerr << s << " went wrong\n";
- return -1;
- }
- catch (const XXX &x)
- {
- cerr << x << " went wrong\n";
- return -1;
- }
- }
-
-
-